<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<th:block th:include="include :: header('添加说明')" />
	<th:block th:include="include :: bootstrap-fileinput-css" />
	<link th:href="@{/css/common.css}" rel="stylesheet"/>
	<link th:href="@{/css/choose_data_map.css}" rel="stylesheet" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight add-question">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox-content">
				<form class="form-horizontal" id="commentForm">
					<input type="hidden" name="id" th:value="${id}">
					<input type="hidden" name="imgType" th:value="${fileInf.imgType}">
					<input type="hidden" name="isMaster" th:value="${fileInf.isMaster}">
					<input type="hidden" name="pageId" th:value="${pageId}">
					<input type="hidden" name="interfaceId" th:value="${interfaceId}">
					<div class="form-group">
						<label class="col-sm-3 control-label is-required">排序：</label>
						<div class="col-sm-8">
							<input name="orderNum" class="form-control" type="number" th:value="${fileInf.orderNum}" required>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
	// 接口uri
	const prefix = ctx + "fileInfo/fileInfo";
	function submitHandler() {
		if ($.validate.form()) {
			if($("input[name='interfaceId']").val()){
				$.modal.close();
				parent.editImage({
					id:$("input[name='id']").val(),
					orderNum: $("input[name='orderNum']").val(),
					isMaster:$("input[name='isMaster']").val(),
					objectType:1
				},$("input[name='interfaceId']").val());
				return false;
			}
			var params = {
				"orderNum": $("input[name='orderNum']").val(),
				"id":$("input[name='id']").val(),
				"imgType":$("input[name='imgType']").val(),
				"isMaster":$("input[name='isMaster']").val()
			};
			var config = {
				url: prefix + "/edit",
				type: "POST",
				dataType: "json",
				data: params,
				beforeSend: function () {
					$.modal.loading("正在处理中，请稍后...");
					$.modal.disable();
				},
				success: function(result) {
					$.modal.closeLoading();
					if (result.code == web_status.SUCCESS) {
						$.modal.close();
						// 父页面更新
						parent.pageImgList($("input[name='pageId']").val(), 0);
						return false;
					}
					if (result.code == web_status.WARNING) {
						$.modal.alertWarning(result.msg);
						return false;
					}
					$.modal.alertError(result.msg);
				}
			};
			$.ajax(config);
		}
	}
</script>
</body>
</html>

